# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Spanner.V1.Model.RestoreDatabaseMetadata do
  @moduledoc """
  Metadata type for the long-running operation returned by RestoreDatabase.

  ## Attributes

  *   `backupInfo` (*type:* `GoogleApi.Spanner.V1.Model.BackupInfo.t`, *default:* `nil`) - Information about the backup used to restore the database.
  *   `cancelTime` (*type:* `DateTime.t`, *default:* `nil`) - The time at which cancellation of this operation was received. Operations.CancelOperation starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of 1, corresponding to `Code.CANCELLED`.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Name of the database being created and restored to.
  *   `optimizeDatabaseOperationName` (*type:* `String.t`, *default:* `nil`) - If exists, the name of the long-running operation that will be used to track the post-restore optimization process to optimize the performance of the restored database, and remove the dependency on the restore source. The name is of the form `projects//instances//databases//operations/` where the is the name of database being created and restored to. The metadata type of the long-running operation is OptimizeRestoredDatabaseMetadata. This long-running operation will be automatically created by the system after the RestoreDatabase long-running operation completes successfully. This operation will not be created if the restore was not successful.
  *   `progress` (*type:* `GoogleApi.Spanner.V1.Model.OperationProgress.t`, *default:* `nil`) - The progress of the RestoreDatabase operation.
  *   `sourceType` (*type:* `String.t`, *default:* `nil`) - The type of the restore source.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :backupInfo => GoogleApi.Spanner.V1.Model.BackupInfo.t() | nil,
          :cancelTime => DateTime.t() | nil,
          :name => String.t() | nil,
          :optimizeDatabaseOperationName => String.t() | nil,
          :progress => GoogleApi.Spanner.V1.Model.OperationProgress.t() | nil,
          :sourceType => String.t() | nil
        }

  field(:backupInfo, as: GoogleApi.Spanner.V1.Model.BackupInfo)
  field(:cancelTime, as: DateTime)
  field(:name)
  field(:optimizeDatabaseOperationName)
  field(:progress, as: GoogleApi.Spanner.V1.Model.OperationProgress)
  field(:sourceType)
end

defimpl Poison.Decoder, for: GoogleApi.Spanner.V1.Model.RestoreDatabaseMetadata do
  def decode(value, options) do
    GoogleApi.Spanner.V1.Model.RestoreDatabaseMetadata.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Spanner.V1.Model.RestoreDatabaseMetadata do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
